package com.hong.day03.activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;

/**
 * @Auther: csh
 * @Date: 2019/11/21 18:38
 * @Description:
 */
public class BusinessKeyAdd {
    public static void main(String[] args) {
        //1.得到ProcessEngine对象
        ProcessEngine defaultProcessEngine = ProcessEngines.getDefaultProcessEngine();
        //2.得到runtimeService对象
        RuntimeService runtimeService = defaultProcessEngine.getRuntimeService();
        //3.启动流程实例 同时还要指定业务标识businessKey 它本身就是请假单的id
        //第一个参数：指流程定义key
        //第二个参数:业务标识businessKey
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("holiday", "5001");
        //4.输出processInstance相关的属性
        System.out.println(processInstance.getBusinessKey());
    }
}
